<template>
	<view class="content">
		<!-- <video id="myVideo" style="height: 530rpx;" class="wid100" :src="url+list.videolink" :poster="url+list.coverimg"
			@error="videoErrorCallback" :object-fit='fill' controls></video> -->
		<view style="height: 30rpx;"></view>
		<view class="wid90 mar bacFFF borRad20" style="min-height: calc(100vh - 80rpx);">
			<view class="wid90 mar">
				<view style="height: 20rpx;"></view>
				<view class="hei60 dis disAl foSi25" style="color: #ACABAB;">上线时间：{{list.createtime}}</view>
				<view class="dis disAl disJuB">
					<view class="foSi40" style="font-weight: 600;width: 65%;">{{list.title}}</view>
					<view class="foSi30" style="color: #ACABAB;width: 35%;">来源于：{{list.source}}</view>
				</view>
				<view class="mar-top30 foSi35 mar-bott20" style="font-weight: 600;">详情内容：</view>
				<rich-text :nodes="list.content"></rich-text>
			</view>
		</view>
		<view style="height: 50rpx;"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: '',
				id: '',
				url: this.global.url
			}
		},
		onLoad(options) {
			this.id = options.id
			this.getList()
		},
		methods: {
			getList(){
				var that = this
				uni.request({
				    url: that.global.url + 'api/classroom/details',
				    method: "POST",
					header: {
						'token': uni.getStorageSync('token')
					},
				    data: {
						id: this.id
					},
				    success(res) {
				        let result = res.data
				        if(result.code == 1){
							that.list = result.data
							that.list.content = that.formatGoodsData(that.list.content)
						}else{
				           uni.showToast({
				           	title: result.msg,
				           	icon: 'error'
				           })
				        }
				       
				    }
				})
			},
			videoErrorCallback: function(e) {
				uni.showModal({
					content: e.target.errMsg,
					showCancel: false
				})
			},
			formatGoodsData(data) {
				return data.replace(/width:[^;]+;/gi, 'width: 100%;')
			}
		}
	}
</script>

<style>
	.content {
		height: 100vh;
		background-color: #F0F0F0;
	}
</style>
